<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>用户管理</title>
    <link rel="stylesheet" type="text/css" href="../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css"/>
    <script type="text/javascript" src="../js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="../laydate/laydate.js"></script>
    <script src="../js/city-picker.data.js"></script>
    <script src="../js/city-picker.js"></script>
    <script src="../js/publicJS.js"></script>
    <style>
        .city-picker-span {
            width: 300px;
        }
    </style>
</head>

<body style="background:#328f46">
<div class="headiv">
    <div class="logotag">
        <a class="logo"><img src="../img/logo.png" width="440" height="65"></a>
        <b class="line"></b>
    </div>
    <a class="username">欢迎登录：<i id="name"></i></a>
    <span class="btnbox">
    	<a class="update" href="/updatePerson" title="修改"></a><a class="exit" href="/logout" title="退出"></a>
    </span>
    <div class="clear" style="height:20px; background:#328f46"></div>
</div>

<div class="messagebox">
    <div class="messageleft">
        <ul class="Fstage">
            <shiro:hasRole name="normalUser">
                <li><a href="#"><em class="e3"></em>健康信息管理
                    <div class="clear"></div>
                </a>
                    <ul class="Tstage">
                        <li><a href="/healthInfoAdd">健康信息录入</a></li>
                        <li><a href="/healthInfoSelect">健康指数查询</a></li>
                    </ul>
                </li>
                <li><a href="#"><em class="e3"></em>运动信息管理
                    <div class="clear"></div>
                </a>
                    <ul class="Tstage">
                        <li><a href="/sportIndex">运动信息录入</a></li>
                        <li><a href="/sportIndexSelect">运动信息查询</a></li>
                    </ul>
                </li>
                <li><a href="#"><em class="e3"></em>心理测试
                    <div class="clear"></div>
                </a>
                    <ul class="Tstage">
                        <li><a href="/testPage">开始测试</a></li>
                        <li><a href="/testrecord">测试记录</a></li>
                    </ul>
                </li>
                <li><a href="#"><em class="e3"></em>健康新闻
                    <div class="clear"></div>
                </a>
                    <ul class="Tstage">
                        <li><a href="/healthnewsPage">健康新闻</a></li>
                    </ul>
                </li>
            </shiro:hasRole>

            <shiro:hasRole name="admin">
                <li><a href="#"><em class="e3"></em>用户管理
                    <div class="clear"></div>
                </a>
                    <ul class="Tstage">
                        <li><a href="/userManagement">用户管理</a></li>
                        <li><a href="/userManageSelect">查询所有用户</a></li>
                    </ul>
                </li>
                <li><a href="#"><em class="e3"></em>发布新闻
                    <div class="clear"></div>
                </a>
                    <ul class="Tstage">
                        <li><a href="/releaseNewsPage">发布新闻</a></li>
                    </ul>
                </li>
            </shiro:hasRole>
        </ul>
    </div>
    <!--****************以上不能动，页面固定的东西************************-->
    <div class="messageright formpage">
        按用户名查询：<input type="text" id="username">
        <button id="search">查询</button>
        <br>
        用户信息：
        <table class="table">
            <tr>
                <td>昵称：</td>
                <td id="nickname"></td>
            </tr>
            <tr>
                <td>登录名：</td>
                <td id="logName"></td>
            </tr>
            <tr>
                <td>签名：</td>
                <td id="sign"></td>
            </tr>
            <tr>
                <td>性别：</td>
                <td id="sex"></td>
            </tr>
            <tr>
                <td>电话</td>
                <td id="phoneNumber"></td>
            </tr>
            <tr>
                <td>地区</td>
                <td id="area"></td>
            </tr>
            <tr>
                <td>星座：</td>
                <td id="constellation"></td>
            </tr>
            <tr>
                <td>生日：</td>
                <td id="birthday"></td>
            </tr>
            <tr>
                <td></td>
                <td></td>
            </tr>
            <tr>
                <td>邮箱：</td>
                <td id="email"></td>
            </tr>
            <tr>
                <td>注册时间</td>
                <td id="registerTime"></td>
            </tr>
        </table>
    </div>
</div>

<script src="../js/jquery-3.2.1.js"></script>
<script>
    $("#search").click(function () {
        $.ajax({
            url: "/selecctUser",
            type: "post",
            data: {
                loginname: $("#username").val()
            },
            success: function (result) {
                var user = result.data;
                $("#nickname").html(user.nickname);
                $("#logName").html(user.loginname);
                $("#sign").html(user.signature);
                $("#sex").html(user.sex);
                $("#phoneNumber").html(user.phonenumber);
                $("#area").html(user.area);
                $("#constellation").html(user.constellation);
                $("#birthday").html(user.brthday);
                $("#email").html(user.email);
                $("#registerTime").html(user.registertime);
            },
            error: function () {
                alert("错误");
            }
        })
    })
</script>
</body>
</html>
